﻿using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using WcMatch.Utility;

namespace WcMatch.Models
{
    public class Company
    {
        [JsonIgnore]
        public string UName { get; set; }

        [JsonIgnore]
        public string Pwd { get; set; }

        public string? Name { get; set; }

        //统一社会信用代码/税号
        public string? CompanyId { get; set; }

        //法定代表人姓名
        public string? LegalRepresentative { get;set; }

        //成立日期
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? RegisterTime { get; set; }

        //组织结构代码
        //public string? OrganizationCode { get; set;}

        //注册资本金
        public int RegisteredCapital { get; set; }

        //实缴资本
        public int RealCapital { get; set; }

        //企业类型
        public string? CompanyType { get; set; }

        //工商注册号码
        //public string? RegisterCode { get; set; }

        //员工总数量
        public int EmployeeSize { get; set;}

        public string? Province { get; set; }

        public string? City { get;set; }

        //行业
        public string? Industry { get; set; }

        public string? Addr { get; set; }

        //营业范围
        //public string? BusinessScope { get; set; }

        public string? NameOfContact { get; set; }

        public string? PhoneOfContact { get; set; }

        //企业简介
        public string? EnterpriseProfile { get; set; }

        [JsonIgnore]
        [Key]
        public string Uid { get; set; }

        [JsonIgnore]
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? UpdateTime { get; set; }

        [JsonIgnore]
        public string? ZzPath { get;set; }

        [JsonIgnore]
        public string? IdCardPath { get; set; }

        [JsonIgnore]
        public string? SqPath { get;set; }

        //申请授权的时间，一年内有效
        [JsonIgnore]
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? PubJobDate { get; set; }

        //是否能发布工作，1可以，0不可以
        public int CanPubJob { get; set; } = 0;

        public Company() {
            Uid = Guid.NewGuid().ToString();
            UpdateTime = DateTime.Today;
        }

        public Company(string uname, string pwd)
        {
            UName = uname;
            Pwd = pwd;
            Uid = Guid.NewGuid().ToString();    
            UpdateTime = DateTime.Today;
        }
    }
}
